package com.boxfishedu.conf;

import lombok.Data;
import org.apache.tomcat.jdbc.pool.DataSource;
import org.apache.tomcat.jdbc.pool.PoolProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by lzx on 16/7/5.
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "datasource.second")
public class SecondPoolProperties extends PoolProperties{

    @Bean(name = "secondDataSource")
    public DataSource dataSource(){
        DataSource dataSource = new DataSource();
        dataSource.setPoolProperties(this);
        return dataSource;
    }
}
